#!/bin/sh

# tlp - system startup/shutdown
#
# Copyright (c) 2024 Thomas Koch <linrunner at gmx.net> and others.
# This software is licensed under the GPL v2 or later.
#
# chkconfig: 2345 98 01

### BEGIN INIT INFO
# Provides:          tlp
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: tlp start/stop script
# Description:       Initialize tlp
### END INIT INFO

[ -r /lib/lsb/init-functions ] && . /lib/lsb/init-functions

TLP=/usr/sbin/tlp
[ -x $TLP ] || exit 0

case "$1" in
    status)
        tlp-stat -s
        ;;

    start|\
    stop|\
    restart|\
    force-reload)
        $TLP init $1
        ;;

     *)
        echo "Usage: $0 start|stop|restart|force-reload|status" 1>&2
        exit 3
        ;;
esac

exit 0
